home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / samples / sendsys < prev    next >
Text File  |  1993-12-22  |  1KB  |  60 lines

  1. #! /bin/sh
  2. ##  $Revision: 1.12 $
  3. ##  Sendsys control-message handler
  4.  
  5. PROG=sendsys
  6. ##  Some shells don't pass in $* unless we explicitly pass it in here.
  7. ##  =()<. @<_PATH_PARSECTL>@ "$@">()=
  8. . /news/bin/control/parsecontrol "$@"
  9.  
  10. ##  See if the poster should have given an argument.
  11. case "${ACTION}-$1" in
  12. doifarg-)
  13.     ACTION=mail
  14.     ;;
  15. doifarg-*)
  16.     ACTION=doit
  17.     ;;
  18. esac
  19.  
  20. SUBJECT="Sendsys reply from `innconfval pathhost`"
  21. case ${ACTION} in
  22. mail)
  23.     export FROM MAILCMD SUBJECT ARTICLE
  24.     (
  25.     echo "${FROM} posted a sendsys requesting your newsfeeds file."
  26.     echo ''
  27.     echo 'To reply, do the following:'
  28.     echo "    ${MAILCMD} -s \"${SUBJECT}\" ${FROM} <${NEWSFEEDS}"
  29.     echo ''
  30.     echo 'The full article was:'
  31.     cat ${ARTICLE}
  32.     ) | sed -e 's/^~/~~/' | ${MAILCMD} -s "sendsys by ${FROM}" ${NEWSMASTER}
  33.     ;;
  34. logit)
  35.     ${WRITELOG} ${LOGFILE} "sendsys by ${FROM}; reply skipped" <${ARTICLE}
  36.     ;;
  37. doit)
  38.     case "$1" in
  39.     "")
  40.     ${MAILCMD} -s "${SUBJECT}" ${REPLYTO} <${NEWSFEEDS}
  41.     sed -e 's/^~/~~/' <${ARTICLE} \
  42.         | ${MAILCMD} -s "sendsys by ${FROM}; reply sent" ${NEWSMASTER}
  43.     ;;
  44.     *)
  45.     ${AWK} "/^$1"'[/:\\]/,/[^\\]$/' ${NEWSFEEDS} >${TEMP}
  46.     trap 'rm -f ${TEMP} ; exit' 1 2 3 15
  47.     if [ -s ${TEMP} ] ;  then
  48.         ${MAILCMD} -s "${SUBJECT} for $1" ${REPLYTO} <${TEMP}
  49.         sed -e 's/^~/~~/' <${ARTICLE} \
  50.         | ${MAILCMD} -s "sendsys $1 by ${FROM}; reply sent" \
  51.             ${NEWSMASTER}
  52.     fi
  53.     rm -f ${TEMP}
  54.     ;;
  55.     esac
  56.     ;;
  57. esac
  58.  
  59. exit
  60.